import service from '@/utils/request';

// 获取商家的所有商品
export function getSellerGoods(sellerName) {
  return service.get(`/api/seller/goods/${sellerName}`);
}

// 添加商品
export function addGoods(sellerName, goodsData) {
  return service.post(`/api/seller/goods/stock/add/${sellerName}`, goodsData);
}

// 更新商品信息
export function updateGoods(goodsData) {
  return service.post('/api/seller/goods/update', goodsData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除商品
export function deleteGoods(sellerName, goodsId) {
  return service.post(`/api/seller/goods/stock/delete/${sellerName}`, null, {
    params: { goodsId }
  });
}

// 增加库存
export function increaseStock(goodsId, delta) {
  return service.post('/api/seller/goods/stock/increase', null, {
    params: { goodsId, delta }
  });
}

// 减少库存
export function decreaseStock(goodsId, delta) {
  return service.post('/api/seller/goods/stock/decrease', null, {
    params: { goodsId, delta }
  });
} 